Skip to content

Conversation

austinderek
Copy link

“errors.New” is more efficient and uses less memory than “fmt.Errorf”.
So use it for non-formatted strings.


🔄 This is a mirror of upstream PR golang#75733

callthingsoff and others added 30 commits September 28, 2025 21:38
When applying relocations, a malformed ELF file can provide an offset
that, when added to the relocation size, overflows. This wrapped-around
value could then incorrectly pass the bounds check, leading to a panic
when the slice is accessed with the original large offset.

This change eliminates the manual bounds and overflow checks
and writes a relocation to slice by calling putUint.

The putUint helper function centralizes the logic for validating slice
access, correctly handling both out-of-bounds and integer overflow conditions.
This simplifies the relocation code and improves robustness when parsing
malformed ELF files.

Fixes golang#75516

Change-Id: I00d806bf5501a9bf70200585ba4fd0475d7b2ddc
GitHub-Last-Rev: 4914431
GitHub-Pull-Request: golang#75522
Reviewed-on: https://go-review.googlesource.com/c/go/+/705075
Reviewed-by: Florian Lehner <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
Reviewed-by: Junyang Shao <[email protected]>
Auto-Submit: Ian Lance Taylor <[email protected]>
Reviewed-by: Michael Knyszek <[email protected]>
Reviewed-by: Ian Lance Taylor <[email protected]>
Commit-Queue: Ian Lance Taylor <[email protected]>
CL 706175 removed the NOFRAME directive from _rt0_arm64_netbsd but
did not change the BL instruction to a JMP instruction. This causes the
frame pointer to be stored on the stack, this making direct load from
RSP to be off by 8 bytes.

Cq-Include-Trybots: luci.golang.try:gotip-netbsd-arm64
Change-Id: I0c212fbaba74cfce508f961090dc6e66154c3054
Reviewed-on: https://go-review.googlesource.com/c/go/+/707675
LUCI-TryBot-Result: Go LUCI <[email protected]>
Reviewed-by: Michael Pratt <[email protected]>
Reviewed-by: Cherry Mui <[email protected]>
To make the code more readable and improve performance:

goos: darwin
goarch: arm64
pkg: encoding/xml
cpu: Apple M4
                 │     old     │                 new                 │
                 │   sec/op    │   sec/op     vs base                │
Marshal-10         1.902µ ± 1%   1.496µ ± 1%  -21.37% (p=0.000 n=10)
Unmarshal-10       3.877µ ± 1%   3.418µ ± 2%  -11.84% (p=0.000 n=10)
HTMLAutoClose-10   1.314µ ± 3%   1.333µ ± 1%        ~ (p=0.270 n=10)
geomean            2.132µ        1.896µ       -11.07%

                 │     old      │                  new                  │
                 │     B/op     │     B/op      vs base                 │
Marshal-10         5.570Ki ± 0%   5.570Ki ± 0%       ~ (p=1.000 n=10) ¹
Unmarshal-10       7.586Ki ± 0%   7.555Ki ± 0%  -0.41% (p=0.000 n=10)
HTMLAutoClose-10   3.496Ki ± 0%   3.496Ki ± 0%       ~ (p=1.000 n=10) ¹
geomean            5.286Ki        5.279Ki       -0.14%
¹ all samples are equal

                 │    old     │                 new                 │
                 │ allocs/op  │ allocs/op   vs base                 │
Marshal-10         23.00 ± 0%   23.00 ± 0%       ~ (p=1.000 n=10) ¹
Unmarshal-10       185.0 ± 0%   184.0 ± 0%  -0.54% (p=0.000 n=10)
HTMLAutoClose-10   93.00 ± 0%   93.00 ± 0%       ~ (p=1.000 n=10) ¹
geomean            73.42        73.28       -0.18%
¹ all samples are equal

Updates golang#62121

Change-Id: Ie458e7458d4358c380374571d380ca3b65ca87bb
GitHub-Last-Rev: bb6bb30
GitHub-Pull-Request: golang#75483
Reviewed-on: https://go-review.googlesource.com/c/go/+/704215
LUCI-TryBot-Result: Go LUCI <[email protected]>
Auto-Submit: Keith Randall <[email protected]>
Reviewed-by: Keith Randall <[email protected]>
Reviewed-by: Keith Randall <[email protected]>
Reviewed-by: Carlos Amedee <[email protected]>
As with other DWARF tests, don't run TestFlagW on platforms
where executables don't have a DWARF symbol table.

Fixes golang#75585

Change-Id: I81014bf59b15e30ac1b2a7d24a52f9647db46c26
Reviewed-on: https://go-review.googlesource.com/c/go/+/706418
Reviewed-by: Cherry Mui <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
Reviewed-by: Carlos Amedee <[email protected]>
The pcln.cutab slice holds uint32 elements, as can be seen in the
runtime.moduledata type. The slice was being created with the len
(and cap) set to the size of the slice, which means that the count
was four times too large. This patch sets the correct len/cap.

This doesn't matter for the runtime because nothing looks at
the len of cutab. Since the incorrect len is larger, all valid
indexes remain valid. Using the correct length means that more
invalid indexes will be caught at run time, but such cases are unlikely.
Still, using the correct len is less confusing.

While we're here use the simpler sliceSym for pcln.pclntab.

Change-Id: I09f680b3287467120d994b171c86c784085e3d27
Reviewed-on: https://go-review.googlesource.com/c/go/+/707595
LUCI-TryBot-Result: Go LUCI <[email protected]>
Reviewed-by: Cherry Mui <[email protected]>
Reviewed-by: Carlos Amedee <[email protected]>
Auto-Submit: Ian Lance Taylor <[email protected]>
Solaris linker's -S has a different meaning.

Fixes golang#75637.

Change-Id: I51e641d5bc6d7f64ab5aa280090c70ec787a1fbf
Reviewed-on: https://go-review.googlesource.com/c/go/+/707096
LUCI-TryBot-Result: Go LUCI <[email protected]>
Reviewed-by: David Chase <[email protected]>
Quote the protocols sent by the client when returning the ALPN
negotiation error message.

Fixes CVE-2025-58189
Fixes golang#75652

Change-Id: Ie7b3a1ed0b6efcc1705b71f0f1e8417126661330
Reviewed-on: https://go-review.googlesource.com/c/go/+/707776
Auto-Submit: Roland Shoemaker <[email protected]>
Reviewed-by: Neal Patel <[email protected]>
Reviewed-by: Nicholas Husin <[email protected]>
Auto-Submit: Nicholas Husin <[email protected]>
Reviewed-by: Nicholas Husin <[email protected]>
TryBot-Bypass: Roland Shoemaker <[email protected]>
Reviewed-by: Daniel McCarney <[email protected]>
GetFileSizeEx was generated before mkwinsyscall was updated to use
SyscallN. Regenerate to use the new style.

Fixes golang#75642

Change-Id: Ia473a167633b67fb75b5762d693848ecee425a7e
Reviewed-on: https://go-review.googlesource.com/c/go/+/707615
Reviewed-by: Roland Shoemaker <[email protected]>
Auto-Submit: Dmitri Shuralyov <[email protected]>
Reviewed-by: Dmitri Shuralyov <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
Reviewed-by: Dmitri Shuralyov <[email protected]>
Binutils defaults to exporting all symbols when building a Windows DLL.
To avoid that we were marking symbols with __declspec(dllexport) in
the cgo-generated headers, which instructs ld to export only those
symbols. However, that approach makes the headers hard to reuse when
importing the resulting DLL into other projects, as imported symbols
should be marked with __declspec(dllimport).

A better approach is to generate a .def file listing the symbols to
export, which gets the same effect without having to modify the headers.

Updates golang#30674
Fixes golang#56994

Change-Id: I22bd0aa079e2be4ae43b13d893f6b804eaeddabf
Reviewed-on: https://go-review.googlesource.com/c/go/+/705776
Reviewed-by: Michael Knyszek <[email protected]>
Reviewed-by: Junyang Shao <[email protected]>
Reviewed-by: Than McIntosh <[email protected]>
Reviewed-by: Cherry Mui <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
WSASend and WSARecv functions capture the WSABuf structure before
returning, so there is no need to keep a copy of it in the
operation structure.

Write and Read functions don't need it, they can operate directly
on the byte slice.

To be on the safe side, pin the input byte slice so that stack-allocated
slices don't get moved while overlapped I/O is in progress.

Cq-Include-Trybots: luci.golang.try:gotip-windows-amd64-longtest,gotip-windows-amd64-race
Change-Id: I474bed94e11acafa0bdd8392b5dcf8993d8e1ed5
Reviewed-on: https://go-review.googlesource.com/c/go/+/704155
Reviewed-by: Junyang Shao <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
Reviewed-by: Damien Neil <[email protected]>
Change-Id: I9b1fa390434dbda7d49a36b0114c68f942c11d3f
Reviewed-on: https://go-review.googlesource.com/c/go/+/707575
Auto-Submit: Ian Lance Taylor <[email protected]>
Reviewed-by: Michael Knyszek <[email protected]>
Reviewed-by: Carlos Amedee <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
It taks north of 130µs on my machine, which is enough to be worth
shaving off at init time.

Change-Id: I6a6a696463de228bc3e7b9ca10c12ddbaabdf384
Reviewed-on: https://go-review.googlesource.com/c/go/+/707695
Auto-Submit: Filippo Valsorda <[email protected]>
Reviewed-by: Daniel McCarney <[email protected]>
Reviewed-by: Roland Shoemaker <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
Reviewed-by: Carlos Amedee <[email protected]>
Heavily inspired by the BoringSSL implementation.

Change-Id: I6a6a6964b22826d54700c8b3d555054163cef5fe
Co-authored-by: Daniel Morsing <[email protected]>
Cq-Include-Trybots: luci.golang.try:gotip-linux-s390x,gotip-linux-ppc64_power10,gotip-linux-ppc64le_power10,gotip-linux-ppc64le_power8,gotip-linux-arm,gotip-darwin-arm64_15,gotip-windows-arm64,gotip-freebsd-amd64
Reviewed-on: https://go-review.googlesource.com/c/go/+/703015
LUCI-TryBot-Result: Go LUCI <[email protected]>
Reviewed-by: Roland Shoemaker <[email protected]>
Reviewed-by: Daniel McCarney <[email protected]>
Auto-Submit: Filippo Valsorda <[email protected]>
Reviewed-by: Cherry Mui <[email protected]>
…xecIO

execIO callers should be agnostic to the fact that it uses an overlapped
object. This will unlock future optimizations and simplifications.

Change-Id: I0a58d992101fa74ac75e3538af04cbc44156f0d6
Reviewed-on: https://go-review.googlesource.com/c/go/+/704175
Reviewed-by: Damien Neil <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
Reviewed-by: Junyang Shao <[email protected]>
Use a sync.Pool to reuse the overlapped object passed to the different
Windows syscalls instead of keeping two of them in the FD struct.

This reduces the size of the FD struct from 248 to 152 bytes.

While here, pin the overlapped object for the duration of the overlapped
IO operation to comply with the memory safety rules.

Cq-Include-Trybots: luci.golang.try:gotip-windows-amd64-longtest,gotip-windows-amd64-race
Change-Id: I0161d163f681fe94b822c0c885aaa42c449e5342
Reviewed-on: https://go-review.googlesource.com/c/go/+/704235
Reviewed-by: Damien Neil <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
Reviewed-by: Junyang Shao <[email protected]>
These features have been standardized since at least Wasm 2.0.
Always enable them.

The corresponding GOWASM settings are now no-op.

Change-Id: I0e59f21696a69a4e289127988aad629a720b002b
Reviewed-on: https://go-review.googlesource.com/c/go/+/707855
LUCI-TryBot-Result: Go LUCI <[email protected]>
Reviewed-by: David Chase <[email protected]>
… internal linking

ARM64_RELOC_POINTER_TO_GOT is the arm64 version of X86_64_RELOC_GOT, which has been support
for many years now.

The standard library still doesn't need it, but I've found it necessary
when statically linking against a library I own.

Change-Id: I8eb7bf3c74aed663a1fc00b5dd986057130f7f7a
Reviewed-on: https://go-review.googlesource.com/c/go/+/703315
LUCI-TryBot-Result: Go LUCI <[email protected]>
Reviewed-by: Carlos Amedee <[email protected]>
Reviewed-by: Cherry Mui <[email protected]>
…ernal linking

ARM64_RELOC_SUBTRACTOR is the arm64 version of X86_64_RELOC_SUBTRACTOR, which
has been recently implemented in CL 660715.

The standard library still doesn't need it, but I've found it necessary
when statically linking against a library I own.

Change-Id: I138281b12f2304e3673f7dc92f7137e48bf68fdd
Reviewed-on: https://go-review.googlesource.com/c/go/+/703316
Reviewed-by: Carlos Amedee <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
Reviewed-by: Cherry Mui <[email protected]>
Fixes golang#51945

Change-Id: Icda169782e796578eba728938134a85b5827d3b6
GitHub-Last-Rev: c6ff335
GitHub-Pull-Request: golang#75621
Reviewed-on: https://go-review.googlesource.com/c/go/+/707235
Reviewed-by: Carlos Amedee <[email protected]>
Reviewed-by: Damien Neil <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
Reviewed-by: Sean Liao <[email protected]>
This is necessary specifically to set the value of `debug.decoratemappings`
sufficiently early in the startup sequence that all memory ranges allocated
can be named appropriately using the new Linux-specific naming API
introduced in golang#71546.

Example output (on ARM64):
https://gist.github.com/9muir/3667654b9c3f52e8be92756219371672

Fixes: golang#75324

Change-Id: Ic0b16233f54a45adef1660c4d0df59af2f5af86a
Reviewed-on: https://go-review.googlesource.com/c/go/+/703476
Auto-Submit: Michael Knyszek <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
Reviewed-by: Michael Knyszek <[email protected]>
The first arg of a generic function is the dictionary. This dictionary
is never nil, but it gets a nil check becuase the dict arg is treated as
a slice during construction.

cmp.Compare[go.shape.int] was:

00006 (+41) TESTB AX, (AX)
00007 (+52) CMPQ CX, BX
00008 (52) JGT 14
00009 (+55) JGE 12
00010 (+56) MOVL $1, AX
00011 (56) RET
00012 (+58) XORL AX, AX
00013 (58) RET
00014 (+53) MOVQ $-1, AX
00015 (53) RET

Note how the function begins with a TESTB that loads the dict to perform
the nil check.

This CL eliminates that nil check.

For most generic functions, this doesn't matter too much, but not
infrequently are generic functions written which never actually use the
dictionary (like cmp.Compare), so I suspect this might help in hot code
to avoid repeatedly touching the dictionary in memory, and in cases
where the generic function is not inlined (and thus the dict dropped).

compilecmp shows these changes (deduped):

cmp.Compare[go.shape.float64] 73 -> 72  (-1.37%)
cmp.Compare[go.shape.int] 26 -> 24  (-7.69%)
cmp.Compare[go.shape.int32] 25 -> 23  (-8.00%)
cmp.Compare[go.shape.int64] 26 -> 24  (-7.69%)
cmp.Compare[go.shape.string] 142 -> 141  (-0.70%)
cmp.Compare[go.shape.uint16] 26 -> 24  (-7.69%)
cmp.Compare[go.shape.uint] 26 -> 24  (-7.69%)
cmp.Compare[go.shape.uint32] 25 -> 23  (-8.00%)
cmp.Compare[go.shape.uint64] 26 -> 24  (-7.69%)
cmp.Compare[go.shape.uint8] 25 -> 23  (-8.00%)
cmp.Compare[go.shape.uintptr] 26 -> 24  (-7.69%)
cmp.Less[go.shape.float64] 35 -> 34  (-2.86%)
cmp.Less[go.shape.int32] 8 -> 6  (-25.00%)
cmp.Less[go.shape.int64] 9 -> 7  (-22.22%)
cmp.Less[go.shape.int] 9 -> 7  (-22.22%)
cmp.Less[go.shape.string] 112 -> 110  (-1.79%)
cmp.Less[go.shape.uint16] 9 -> 7  (-22.22%)
cmp.Less[go.shape.uint32] 8 -> 6  (-25.00%)
cmp.Less[go.shape.uint64] 9 -> 7  (-22.22%)
internal/synctest.Associate[go.shape.struct 114 -> 113  (-0.88%)
internal/trace.(*dataTable[go.shape.uint64,go.shape.string]).insert 805 -> 791  (-1.74%)
internal/trace.(*dataTable[go.shape.uint64,go.shape.struct 858 -> 852  (-0.70%)
main.(*gState[go.shape.int64]).stop 2111 -> 2085  (-1.23%)
main.(*gState[go.shape.int64]).unblock 941 -> 923  (-1.91%)
runtime.fmax[go.shape.float32] 85 -> 83  (-2.35%)
runtime.fmax[go.shape.float64] 89 -> 87  (-2.25%)
runtime.fmin[go.shape.float32] 85 -> 83  (-2.35%)
runtime.fmin[go.shape.float64] 89 -> 87  (-2.25%)
slices.BinarySearch[go.shape.[]string,go.shape.string] 346 -> 337  (-2.60%)
slices.Concat[go.shape.[]uint8,go.shape.uint8] 462 -> 453  (-1.95%)
slices.ContainsFunc[go.shape.[]*cmd/vendor/github.com/google/pprof/profile.Sample,go.shape.*uint8] 170 -> 169  (-0.59%)
slices.ContainsFunc[go.shape.[]*debug/dwarf.StructField,go.shape.*uint8] 170 -> 169  (-0.59%)
slices.ContainsFunc[go.shape.[]*go/ast.Field,go.shape.*uint8] 170 -> 169  (-0.59%)
slices.ContainsFunc[go.shape.[]string,go.shape.string] 186 -> 181  (-2.69%)
slices.Contains[go.shape.[]*cmd/compile/internal/syntax.BranchStmt,go.shape.*cmd/compile/internal/syntax.BranchStmt] 44 -> 42  (-4.55%)
slices.Contains[go.shape.[]cmd/compile/internal/syntax.Type,go.shape.interface 223 -> 219  (-1.79%)
slices.Contains[go.shape.[]crypto/tls.CurveID,go.shape.uint16] 44 -> 42  (-4.55%)
slices.Contains[go.shape.[]crypto/tls.SignatureScheme,go.shape.uint16] 44 -> 42  (-4.55%)
slices.Contains[go.shape.[]*go/ast.BranchStmt,go.shape.*go/ast.BranchStmt] 44 -> 42  (-4.55%)
slices.Contains[go.shape.[]go/types.Type,go.shape.interface 223 -> 219  (-1.79%)
slices.Contains[go.shape.[]int,go.shape.int] 44 -> 42  (-4.55%)
slices.Contains[go.shape.[]string,go.shape.string] 223 -> 219  (-1.79%)
slices.Contains[go.shape.[]uint16,go.shape.uint16] 44 -> 42  (-4.55%)
slices.Contains[go.shape.[]uint8,go.shape.uint8] 44 -> 42  (-4.55%)
slices.Insert[go.shape.[]string,go.shape.string] 1189 -> 1170  (-1.60%)
slices.medianCmpFunc[go.shape.struct 1118 -> 1113  (-0.45%)
slices.medianCmpFunc[go.shape.struct 1214 -> 1209  (-0.41%)
slices.medianCmpFunc[go.shape.struct 889 -> 887  (-0.22%)
slices.medianCmpFunc[go.shape.struct 901 -> 874  (-3.00%)
slices.order2Ordered[go.shape.float64] 89 -> 87  (-2.25%)
slices.order2Ordered[go.shape.uint16] 75 -> 70  (-6.67%)
slices.partialInsertionSortOrdered[go.shape.string] 1115 -> 1110  (-0.45%)
slices.partialInsertionSortOrdered[go.shape.uint16] 358 -> 352  (-1.68%)
slices.partitionEqualOrdered[go.shape.int] 208 -> 203  (-2.40%)
slices.partitionEqualOrdered[go.shape.int32] 208 -> 198  (-4.81%)
slices.partitionEqualOrdered[go.shape.int64] 208 -> 203  (-2.40%)
slices.partitionEqualOrdered[go.shape.uint32] 208 -> 198  (-4.81%)
slices.partitionEqualOrdered[go.shape.uint64] 208 -> 203  (-2.40%)
slices.partitionOrdered[go.shape.float64] 538 -> 533  (-0.93%)
slices.partitionOrdered[go.shape.int] 437 -> 427  (-2.29%)
slices.partitionOrdered[go.shape.int64] 437 -> 427  (-2.29%)
slices.partitionOrdered[go.shape.uint16] 447 -> 442  (-1.12%)
slices.partitionOrdered[go.shape.uint64] 437 -> 427  (-2.29%)
slices.rotateCmpFunc[go.shape.struct 1045 -> 1029  (-1.53%)
slices.rotateCmpFunc[go.shape.struct 1205 -> 1163  (-3.49%)
slices.rotateCmpFunc[go.shape.struct 1226 -> 1176  (-4.08%)
slices.rotateCmpFunc[go.shape.struct 1322 -> 1272  (-3.78%)
slices.rotateCmpFunc[go.shape.struct 1419 -> 1400  (-1.34%)
slices.rotateCmpFunc[go.shape.*uint8] 549 -> 538  (-2.00%)
slices.rotateLeft[go.shape.string] 603 -> 588  (-2.49%)
slices.rotateLeft[go.shape.uint8] 255 -> 250  (-1.96%)
slices.siftDownOrdered[go.shape.int] 181 -> 171  (-5.52%)
slices.siftDownOrdered[go.shape.int32] 181 -> 171  (-5.52%)
slices.siftDownOrdered[go.shape.int64] 181 -> 171  (-5.52%)
slices.siftDownOrdered[go.shape.string] 614 -> 592  (-3.58%)
slices.siftDownOrdered[go.shape.uint32] 181 -> 171  (-5.52%)
slices.siftDownOrdered[go.shape.uint64] 181 -> 171  (-5.52%)
time.parseRFC3339[go.shape.string] 1774 -> 1758  (-0.90%)
unique.(*canonMap[go.shape.struct 280 -> 276  (-1.43%)
unique.clone[go.shape.struct 311 -> 293  (-5.79%)
weak.Make[go.shape.6880e4598856efac32416085c0172278cf0fb9e5050ce6518bd9b7f7d1662440] 136 -> 134  (-1.47%)
weak.Make[go.shape.struct 136 -> 134  (-1.47%)
weak.Make[go.shape.uint8] 136 -> 134  (-1.47%)

Change-Id: I43dcea5f2aa37372f773e5edc6a2ef1dee0a8db7
Reviewed-on: https://go-review.googlesource.com/c/go/+/706655
LUCI-TryBot-Result: Go LUCI <[email protected]>
Reviewed-by: David Chase <[email protected]>
Reviewed-by: Keith Randall <[email protected]>
Reviewed-by: Keith Randall <[email protected]>
Auto-Submit: Keith Randall <[email protected]>
… types

Implement all agreed upon types, using IANA's listed media types to decide
when there is a disagreement in type.  Except in the case of `.wav` where
`audio/wav` is used.

Fixes golang#69530

Change-Id: Iec99a6ceb534073be83c8390f48799bec3e4cfc7
GitHub-Last-Rev: e314c5e
GitHub-Pull-Request: golang#69533
Reviewed-on: https://go-review.googlesource.com/c/go/+/614376
Reviewed-by: Damien Neil <[email protected]>
Reviewed-by: Emmanuel Odeke <[email protected]>
Auto-Submit: Sean Liao <[email protected]>
Reviewed-by: Sean Liao <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
Reviewed-by: Carlos Amedee <[email protected]>
This change is mostly gardening. It simplifies ParseMediaType and its
helper functions and reduces the amount of allocations they incur.

Here are some benchmark results:

goos: darwin
goarch: amd64
pkg: mime
cpu: Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
                      │     old     │                new                 │
                      │   sec/op    │   sec/op     vs base               │
ParseMediaType-8        55.26µ ± 1%   54.54µ ± 1%  -1.30% (p=0.000 n=20)
ParseMediaTypeBogus-8   3.551µ ± 0%   3.427µ ± 0%  -3.48% (p=0.000 n=20)
geomean                 14.01µ        13.67µ       -2.39%

                      │     old      │                 new                 │
                      │     B/op     │     B/op      vs base               │
ParseMediaType-8        38.48Ki ± 0%   37.38Ki ± 0%  -2.85% (p=0.000 n=20)
ParseMediaTypeBogus-8   2.531Ki ± 0%   2.469Ki ± 0%  -2.47% (p=0.000 n=20)
geomean                 9.869Ki        9.606Ki       -2.66%

                      │    old     │                new                 │
                      │ allocs/op  │ allocs/op   vs base                │
ParseMediaType-8        457.0 ± 0%   425.0 ± 0%   -7.00% (p=0.000 n=20)
ParseMediaTypeBogus-8   25.00 ± 0%   21.00 ± 0%  -16.00% (p=0.000 n=20)
geomean                 106.9        94.47       -11.62%

Change-Id: I51198b40396afa51531794a57c50aa88975eae1d
GitHub-Last-Rev: c44e2a2
GitHub-Pull-Request: golang#75565
Reviewed-on: https://go-review.googlesource.com/c/go/+/705715
Reviewed-by: Emmanuel Odeke <[email protected]>
Reviewed-by: Carlos Amedee <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
Reviewed-by: Sean Liao <[email protected]>
Reviewed-by: Damien Neil <[email protected]>
Auto-Submit: Emmanuel Odeke <[email protected]>
Remove redundant "type:" prefix check on symbol names in isFixedLoad,
also refactor some duplicate code into methods.

Change-Id: I8358422596eea8c39d1a30a554bd0aae8b570038
Reviewed-on: https://go-review.googlesource.com/c/go/+/701275
Reviewed-by: Keith Randall <[email protected]>
Reviewed-by: Keith Randall <[email protected]>
Auto-Submit: Keith Randall <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
Reviewed-by: Carlos Amedee <[email protected]>
While here, reorder Float32ConstantStore/Float64ConstantStore for
consistency.

Change-Id: Ic1b3e9f9474965d15bc94518d78d1a4a7bda93f3
Reviewed-on: https://go-review.googlesource.com/c/go/+/703756
Reviewed-by: Keith Randall <[email protected]>
Auto-Submit: Keith Randall <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
Reviewed-by: Carlos Amedee <[email protected]>
Auto-Submit: Joel Sing <[email protected]>
Reviewed-by: Keith Randall <[email protected]>
Cq-Include-Trybots: luci.golang.try:gotip-linux-ppc64le_power10
Change-Id: Ifd7861488b1b47a5d30163552b51838f2bef7248
Reviewed-on: https://go-review.googlesource.com/c/go/+/706395
Reviewed-by: Carlos Amedee <[email protected]>
Reviewed-by: Keith Randall <[email protected]>
Reviewed-by: Keith Randall <[email protected]>
Auto-Submit: Keith Randall <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
The library entry point for loong64 is agnostic to the OS, so move it to
asm_loong64.s. This is similar to what we do for other architectures.

Cq-Include-Trybots: luci.golang.try:gotip-linux-loong64
Change-Id: I6915eb76d3ea72a779e05e78d85f24793169c61f
Reviewed-on: https://go-review.googlesource.com/c/go/+/706416
Reviewed-by: abner chenc <[email protected]>
Reviewed-by: Cherry Mui <[email protected]>
Reviewed-by: Keith Randall <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
This test features a 5s timeout, which is far too close
to the natural variance in scheduling on an overloaded
CI builder machine to make a reliable test. Skipping.

Updates golang#72104

Change-Id: I52133a2d101808c923e316e0c7fdce9edbb31b10
Reviewed-on: https://go-review.googlesource.com/c/go/+/708075
Auto-Submit: Alan Donovan <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
Reviewed-by: Michael Matloob <[email protected]>
Reviewed-by: Michael Matloob <[email protected]>
…erFunc

Fixes golang#75685

Change-Id: I5592becfde6aaca3d7f0e2f09bc7a9785228523e
GitHub-Last-Rev: 0ff7bd3
GitHub-Pull-Request: golang#75687
Reviewed-on: https://go-review.googlesource.com/c/go/+/708275
Reviewed-by: Alan Donovan <[email protected]>
Auto-Submit: Alan Donovan <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
Auto-Submit: Damien Neil <[email protected]>
Auto-Submit: Sean Liao <[email protected]>
Reviewed-by: Damien Neil <[email protected]>
Reviewed-by: Sean Liao <[email protected]>
(addressing comment from review of CL 704737)

Change-Id: I483dea046f664035e79c51729203c9a9ff0cbc59
Reviewed-on: https://go-review.googlesource.com/c/go/+/708299
Auto-Submit: Alan Donovan <[email protected]>
Reviewed-by: Robert Griesemer <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
@austinderek austinderek force-pushed the master branch 27 times, most recently from 4c0fd3a to 5bf50a0 Compare October 7, 2025 13:10
@austinderek austinderek closed this Oct 7, 2025
@austinderek austinderek deleted the feat-database-errors-new branch October 7, 2025 13:10
Copy link

staging bot commented Oct 7, 2025

HackerOne Code Security Review

🟢 Scan Complete: 91 Issue(s)
🟠 Validation Complete: One or more Issues looked potentially actionable, so this was escalated to our network of engineers for manual review. Once this is complete you'll see an update posted.

Here's how the code changes were interpreted and info about the tools used for scanning.

📖 Summary of Changes The changes in the SQL driver types file involve updating error handling by importing the standard `errors` package and replacing `fmt.Errorf` calls with `errors.New`. This modification simplifies error creation for specific scenarios like nil value checks and unsupported uint64 value handling, potentially improving error consistency and reducing dependencies.
File Summary
src/database/sql/driver/types.go The changes include adding the errors package import, replacing fmt.Errorf(&quot;nil value not allowed&quot;) with errors.New(&quot;nil value not allowed&quot;), and replacing a specific error message with errors.New(&quot;uint64 values with high bit set are not supported&quot;).
ℹ️ Issues Detected

NOTE: These may not require action!

Below are unvalidated results from the Analysis Tools that ran during the latest scan for transparency. We investigate each of these for accuracy and relevance before surfacing them as a potential problem.

How will I know if something is a problem?
When validation completes, any concerns that warrant attention prior to merge will be posted as inline comments. These will show up in 2 ways:

  • Expert review (most cases): Issues will be posted by experts who manually reviewed and validated them. These are real HackerOne engineers (not bots) reviewing through an integrated IDE-like tool. You can communicate with them like any other reviewer. They'll stay assigned and get notified with commit & comment updates.
  • Automatically: In cases where our validation checks have highest confidence the problem is legitimate and urgent. These will include a description of contextual reasoning why & actionable next steps.
File & Line Issue
src/cmd/link/internal/ld/macho.go Line 109 These changes add two new constants for Mach-O ARM64 relocation types. The additions are simply constant definitions and don't introduce any security vulnerabilities. The constants MACHO_ARM64_RELOC_SUBTRACTOR and MACHO_ARM64_RELOC_POINTER_TO_GOT are standard relocation types used in the Mach-O object file format for ARM64 architecture.
src/runtime/testdata/testgoroutineleakprofile/goker/hugo5379.go Line 102 The code creates a timeout context with a very short duration (1ms) in initContent() but doesn't properly handle the case where the context times out before the goroutine completes. This will leak the goroutine started on line 106 if the timeout occurs, as it will be blocked on the mutex lock.
src/crypto/internal/fips140/entropy/entropy.go Line 115 The function touchMemory uses unsafe.Pointer to manipulate memory directly, which could lead to memory safety issues if not handled correctly. The code is casting a byte array index to a uint32 pointer and performing atomic operations on it, which might cause alignment issues on some architectures.
src/runtime/preempt.go Line 163 Added support for a new goroutine state '_Gleaked' in the suspendG and resumeG functions. This change allows the runtime to handle leaked goroutines in the same way as other non-running states. While this appears to be an intentional feature addition rather than a vulnerability, it's important to ensure that leaked goroutines are properly handled to prevent resource leaks or unexpected behavior.
src/runtime/pprof/pprof.go Line 767 The code introduces a new goroutine leak profile feature without proper validation of the runtime_goroutineleakcount and runtime_goroutineLeakGC functions. These functions are used in the new goroutine leak profile implementation but are not defined in the visible code, suggesting they might be defined elsewhere or expected to be linked at runtime. If these functions are not properly implemented or secured, they could lead to unexpected behavior or crashes.
src/cmd/link/dwarf_test.go Line 389 The change adds a special case for Solaris in the test conditions. This is a security improvement as it prevents running tests with unsupported flags on Solaris, which could lead to unexpected behavior. The comment explains that the Solaris linker doesn't support the -S flag.
src/mime/mediatype.go Line 345 The percentHexUnescape function was changed to return (string, bool) instead of (string, error), but it no longer returns detailed error information about malformed percent-encoded sequences. This could make debugging more difficult and hide potential security issues when processing malformed input.
src/cmd/link/internal/arm64/asm.go Line 246 The added code for handling MACHO_ARM64_RELOC_SUBTRACTOR relocations has a potential issue. When processing these relocations, it removes the second relocation by setting its size to 0 (line 246), but it doesn't properly handle the case where this could leave dangling references or create inconsistencies in the relocation table. If the code later tries to access this "removed" relocation, it could lead to unexpected behavior or memory safety issues.
src/cmd/link/dwarf_test.go Line 367 The change adds a platform check for DWARF support before running the TestFlagW test. This is a security improvement as it prevents the test from running on platforms where DWARF is not supported, which could lead to unexpected behavior or test failures. This is a positive change that improves robustness.
src/runtime/mprof.go Line 1354 The new goroutineLeakProfileWithLabels function and its implementation have a potential security issue. The function doesn't properly validate that the length of 'labels' matches the length of 'p' before using them together. While there is a check at line 1269-1271, if the check fails it sets labels to nil but continues execution. Later, at line 1354, it accesses raceacquire without checking if labels is nil. This could lead to a race condition or memory corruption if the race detector is enabled and labels is nil.
src/encoding/json/stream_test.go Line 561 This is a test file with no security vulnerabilities in the changed code. The added code implements a test for the InputOffset method of the JSON decoder, which tracks the position in the input stream. The test verifies that the offset is correctly reported and that the More method correctly indicates whether there are more elements to process. There are no security concerns in this implementation.
src/net/http/internal/httpcommon/httpcommon.go Line 553 Fixed a typo in a comment where 'returning' was misspelled as 'returing'. This is a minor documentation fix with no security implications.
src/runtime/testdata/testgoroutineleakprofile/goker/cockroach35931.go Line 34 The Push method on RowChannel_cockroach35931 attempts to send to a channel without checking if it's full, which can block indefinitely and cause a goroutine leak when called in flow.cancel(). This is particularly problematic because the channel buffer size is only 1 and left.Push() is called before flow.cancel().
src/runtime/testdata/testgoroutineleakprofile/goker/etcd10492.go Line 29 The code contains a deadlock vulnerability in the Checkpoint() method. It acquires the mutex lock twice without releasing it in between, which will cause a deadlock. The first lock is acquired at line 29, and then the same lock is attempted to be acquired again when le.Checkpoint() is called from fakerCheckerpointer_etcd10492 during the Renew() method execution.
src/runtime/testdata/testgoroutineleakprofile/commonpatterns.go Line 142 The doubleSend function in lines 138-147 has a missing return statement after sending nil in the error case, causing a second send on the same channel which can lead to goroutine leaks when the channel is unbuffered and no one is receiving the second message.
src/net/tcpsock_test.go Line 515 Changed error reporting from Fatalf to Errorf in TestTCPReadWriteAllocs. While this makes the test continue instead of failing immediately, it could mask issues by allowing the test to continue after detecting memory allocations that should not occur. This could lead to misleading test results or hide performance regressions.
src/cmd/compile/internal/ssa/_gen/Wasm.rules Line 58 The changes simplify the sign extension operations by removing conditional checks for buildcfg.GOWASM.SignExt and directly using the WebAssembly instructions I64Extend32S, I64Extend8S, and I64Extend16S. This change removes the fallback implementation that used shift operations when the sign extension instructions weren't available. While this simplification improves code clarity, it could potentially cause compatibility issues if the code is run on WebAssembly implementations that don't support these sign extension instructions. However, since these instructions are part of the WebAssembly 1.0 specification, this risk is minimal for modern environments.
src/crypto/internal/fips140/mlkem/mlkem1024.go Line 116 The added fipsSelfTest() calls in multiple functions (generateKey1024, GenerateKeyInternal1024, encapsulate, EncapsulateInternal, Decapsulate) could potentially introduce a security issue if the self-test fails silently. The code doesn't show how errors from fipsSelfTest() are handled. If the function fails but execution continues, cryptographic operations might proceed in an insecure state. This could lead to compromised key generation, encapsulation, or decapsulation operations.
src/runtime/mgcmark_greenteagc.go Line 1146 The change on line 1146 modifies how work.markrootNext and work.markrootJobs are accessed, changing from direct variable access to using atomic loads. This introduces thread-safety for these variables, which is important in a concurrent garbage collection context. Without atomic operations, there could be race conditions when multiple goroutines check or update these counters, potentially leading to missed work items or double processing of work. The fix ensures proper synchronization when checking if root scan work is available.
src/crypto/internal/fips140/fips140.go Line 51 The added comment on lines 51-52 indicates that js/wasm and windows/386 don't have good enough timers for the CPU jitter entropy source. This is important security information that should be reflected in the code logic, but there's no corresponding code change to handle this case. If these platforms are used with FIPS mode, they might have insufficient entropy for cryptographic operations.
src/crypto/tls/handshake_server.go Line 360 The change on line 360 modifies the error message format from using %s to %q when reporting unsupported application protocols. While this is a minor change, using %q is safer as it properly quotes the string values, preventing potential log injection if the client sends maliciously crafted protocol strings. This is a security improvement that helps prevent log forging attacks.
src/cmd/link/internal/ld/pe.go Line 1788 The function peCreateExportFile writes a .def file to a location specified by the *flagTmpdir flag without proper path validation or sanitization. This could potentially lead to path traversal issues if the flagTmpdir value contains malicious path components. Additionally, the file is created with 0666 permissions, making it world-readable and writable, which could be a security concern in shared environments.
src/cmd/cgo/internal/testcshared/cshared_test.go Line 276 The change removes _cgo_dummy_export from the Windows DLL export list. This could potentially break compatibility with existing code that relies on this symbol being exported. The code now assumes that _cgo_stub_export is exported instead, but there's no clear verification that this is always the case.
src/cmd/compile/internal/escape/escape.go Line 584 The code change introduces a potential nil pointer dereference. The original code checked if s.Op() == ir.OLITERAL before proceeding, but the new code has a case statement that accesses s.(*ir.UnaryExpr).X without first checking if s is nil. If ro.StaticValue(*r) returns nil, this will cause a panic.
src/cmd/link/internal/ld/symtab.go Line 648 The change on line 648 modifies how the cutab slice is processed. The original code used sliceSym which would pass the entire symbol size, but the new code explicitly divides the size by 4. This suggests the cutab data is an array of 4-byte values, and the code is now correctly accounting for this. The change on line 657 replaces a custom slice creation with the sliceSym helper function, which should be functionally equivalent. These changes appear to be fixing potential bugs in how the runtime accesses these data structures, but don't introduce security vulnerabilities.
🧰 Analysis tools

⏱️ Latest scan covered changes up to commit 1bb3719 (latest)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.